<template>
	<view class="grid">
		<uni-grid :column="4" :showBorder="false" :highlight="false" @change="changeItem($event)">
			<uni-grid-item v-for="(item,index) in gridData" :key="item.text" :index="item.id" style="height: 150rpx !important;">

				<button open-type='contact'  class="grid-item" v-if="item.id==6">
					<image :src="item.icon" mode=""></image>
					<text class="text">{{item.text}}</text>
				</button>
				<view v-else  class="grid-item">

					<image :src="item.icon" mode=""></image>
					<text class="text">{{item.text}}</text>

				</view>
			</uni-grid-item>

		</uni-grid>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				imgUrl: this.$store.state.imgUrl,
				gridData: [{
						icon: "../../static/index/j.png",
						path: "/page-index-subcontract/incomeDetails/incomeDetails",
						text: "收入明细",
						id: 0

					},
					{
						icon: "../../static/index/g.png",
						path: "/page-index-subcontract/orderStatistics/orderStatistics",
						text: "订单统计",
						id: 1

					},
					{
						icon: "../../static/index/h.png",
						path: "/page-index-subcontract/myWallet/myWallet",
						text: "收入提现",
						id: 2

					},
					{
						icon: "../../static/index/i.png",
						path: "/page-index-subcontract/withdrawalAccount/withdrawalAccount",
						text: "提现账户",
						id: 3

					},
					{
						icon: "../../static/index/e.png",
						path: "/page-mine-subcontract/evaluate/evaluate",
						text: "用户评价",
						id: 4

					},
					{
						icon: "../../static/index/a.png",
						path: "/page-index-subcontract/signIn/signIn",
						text: "服务区域",
						id: 5

					},
					{
						icon: "../../static/index/d.png",
						text: "平台客服",
						path:'/page-index-subcontract/jupp/jupp',
						id: 6

					},
					{
						icon: "../../static/index/dongtai.png",
						text: "我的动态",
						path:'/page-index-subcontract/myDynamic/myDynamic',
						id: 7
					
					}
				],
				imgArray: [{
						src: "images/indexImg/slices_three/lb.png",
					},
					{
						src: "images/indexImg/slices_three/lb.png",
					},
					{
						src: "images/indexImg/slices_three/lb.png",
					}
				],
			}
		},
		methods: {
			changeItem(e) {
				let token = this.$db.get('token')
				let index = e.detail.index
				if (token) {
					if(index==6){
						let url = "https://chat.yunqiaokefu.net/#/yqLink?teamID=95ff59ee-3870-4490-9eb5-f06b5966e283"
						uni.navigateTo({
							url: this.gridData[6].path+'?url='+url
						})
						
					
					}else{
						uni.navigateTo({
							url: this.gridData[index].path
						})
					}
					
					
				} else {
					uni.navigateTo({
						url: "/pages/login/login"
					})
				}
			},
		}
	}
</script>

<style lang="less" scoped>
	.grid {
		margin: 0 30rpx;
		height: 306rpx;
		background: #FFFFFF;
		border-radius: 24rpx;

		.grid-item {
			text-align: center;
			background-color: #FFFFFF;
			display: flex;
			flex-flow: column
		}

		image {
			width: 64rpx;
			height: 64rpx;
			margin: 0 auto;
			margin-top: 25rpx;
		}

		.text {
			font-size: 24rpx;
			font-family: SourceHanSansCN-Light;
			color: #33342E;
			margin-top: 10rpx;
		}
	}
</style>
